var t = getApp();
var template = require('../../../../template/backstageTemplate.js');
Page({
  data: {
    _num: 2,
    text: "未认证",
    showshow: !1,
    wrapBox: !0,
    nameText: "",
    wzshow: !1,
    wzshow1: !0,
    forbidden: !0
  },
  lodinserweis: function() {
    var that = this
    var zid = that.data.zid
    //生成二维码
    t.util.request({
      'url': 'entry/wxapp/Docerweima',
      data: {
        zid: zid,
      },
      success: function(res) {
        console.log(res)
        var weweima = res.data.data.weweima
        var info = JSON.stringify(res.data.data)
        wx.navigateTo({
          url: '/hyb_yl/backstageLifes/pages/dialysis/dialysis?info= ' + info + '&weweima=' + weweima,
        })
      },
    })

  },

  sign: function(a) {
    var e = wx.getStorageSync("log") || "",
      s = this;
    wx.request({
      url: t.globalData.dic + "doctor/arrive/doctorSignin/" + e + "/1/4",
      success: function(a) {
        if (200 == a.data.code) {
          s.setData({
            wzshow: !0,
            wzshow1: !1
          }), console.log(a.data.data), console.log(a.data.data.getIntegral), wx.showToast({
            title: "签到成功，恭喜你获得" + a.data.data.getIntegral + "积分",
            icon: "none",
            duration: 3e3
          });
          var e = wx.getStorageSync("log") || "";
          wx.request({
            url: t.globalData.dic + "doctor/personal/info/get/" + e,
            data: {},
            success: function(t) {
              s.setData({
                arr: t.data.data
              });
            }
          });
        }
      }
    });
  },
  signs: function(t) {
    wx.showToast({
      title: "您已签到",
      icon: "none",
      duration: 3e3
    });
  },
  alet: function(t) {
    this.setData({
      showshow: !1
    });
  },
  wrapBox: function(t) {
    this.setData({
      showshow: !0
    });
  },
  onLoad: function(options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var that = this
    this.Images();
    this.getMyzhuan();
    this.getMymoney()
    template.tabbar("tabBar", 3, this)
    t.util.request({
      'url': 'entry/wxapp/Studio.ifzhuanjia',
      data: {
        openid: wx.getStorageSync('openid')
      },
      success: function(res) {
        var zid = res.data.data.zid
        t.util.request({
          'url': 'entry/wxapp/Orderguan',
          data: {
            zid: zid
          },
          success: function(res) {
            console.log(res)
            that.setData({
              signCount: (res.data.data.length)
            })
          }
        })
      },
      fail: function(err) {
        console.log(err)
      },
    })

  },
  onShow: function(a) {
    var that = this
    let pages = getCurrentPages();
    let currPage = pages[pages.length - 1];
    if (currPage.data.state == 1) {
      that.getMymoney()
    }
  },
  RenZheng: function(t) {
    var zid = t.currentTarget.dataset.zid
    console.log(t)
    wx.navigateTo({
      url: "/hyb_yl/backstageOther/pages/myRenZheng/myRenZheng?zid=" + zid
    });
  },
  wrap: function(t) {
    this.setData({
      hidehide: !0
    });
  },
  Images: function(a) {
    var e = this;

  },
  getMyzhuan: function() {
    var that = this
    t.util.request({
      'url': 'entry/wxapp/Studio.ifzhuanjia',
      data: {
        openid: wx.getStorageSync('openid')
      },
      success: function(res) {
        console.log(res)
        that.setData({
          zhuanjiaImg: res.data.z_thumbs,
          zid: res.data.zid,
          zhuanjia: res.data,
          z_yy_sheng: res.data.exa
        })
      },
      fail: function(err) {
        console.log(err)
      },
    })
  },

  getMymoney: function() {
    var that = this
    var openid = wx.getStorageSync('openid')
    t.util.request({
      'url': 'entry/wxapp/Doctormoney',
      data: {
        openid: openid
      },
      success: function(res) {
        console.log(res)
        that.setData({
          zhuanmoney: res.data.data.overmoney,
          num: res.data.data.overmoney
        })
      },
      fail: function(err) {
        console.log(err)
      },

    })
  },
  //总收益
  zongClick: function(e) {
    var that = this
    var docmoney = e.currentTarget.dataset.docmoney
    var z_name = e.currentTarget.dataset.z_name
    var zid = that.data.zid
    //查询收益明细
    t.util.request({
      'url': 'entry/wxapp/Zhuanjshouymx',
      data: {
        zid: zid
      },
      success: function(res) {
        console.log(res)
        var record = JSON.stringify(res.data)
        wx.navigateTo({
          url: '/hyb_yl/backstageLifes/pages/mn/mn?record=' + record + '&zid=' + zid + '&docmoney=' + docmoney + '&z_name=' + z_name,
        })
      }
    })
  },
});